
import Api from '@/database'
import { defineWrappedResponseHandler } from '../utils/handler'

const handler = defineEventHandler(async (e) => {
  const { table, size, no, where, orderBy } = await readBody(e)
  return await new Api.Entity(table).page({
    size, no, where, orderBy
  })
})

export default defineWrappedResponseHandler(handler)